package k4_thread.demo09;

public class ATMTest {

    public static void main(String[] args) {

        Account account = new Account(200);

        ATM user1 = new ATM(account);
        ATM user2 = new ATM(account);

        new Thread(()->{
            synchronized (ATM.class){
                user1.showMoney();
                user1.saveMoney(100);
                user1.showMoney();
            }
        }).start();

        new Thread(()->{
            synchronized (ATM.class){
                user2.showMoney();
                user2.takeMoney(50);
                user2.showMoney();
            }

        }).start();


    }


}
